"""
URL configuration for backed project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
from backed.auth import login_view, logout_view, info_view, register_view, change_password_view
from backed.user import get_user_info, update_user_info

# 定义URL模式
urlpatterns = [
    path('admin/', admin.site.urls),
    
    # 用户认证相关接口
    path('zhahuo/auth/login', login_view, name='auth_login'),
    path('zhahuo/auth/logout', logout_view, name='auth_logout'),
    path('zhahuo/auth/info', info_view, name='auth_info'),
    path('zhahuo/auth/register', register_view, name='auth_register'),
    path('zhahuo/auth/change-password', change_password_view, name='auth_change_password'),
    
    # 用户管理相关接口
    path('zhahuo/user/info', get_user_info, name='user_get_info'),
    path('zhahuo/user/info', update_user_info, name='user_update_info'),
    
    # API schema 生成端点
    path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
    # Swagger UI 界面
    path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
    # ReDoc 界面
    path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
]
